package com.adteam.xmap.web;

import java.util.List;

import com.adteam.xmap.entity.Picture;
import com.adteam.xmap.manager.PictureManager;
import com.opensymphony.xwork2.ActionSupport;

public class PictureAction extends ActionSupport {

	private static final long serialVersionUID = 1L;
	
	private PictureManager pictureManager;
	
	private Picture picture;
	
	private List pictures;
	
	private Integer id;

	@Override
	public String execute() {
		
		pictures = pictureManager.findAllPictures();
		return "SUCCESS";
	}
	
	public String addInput() {
		
		return "add_input";
	}
	
	public String add() {
		
		pictureManager.addPicture(picture);
		return "add_success";
	}
	
	public String del() {
		
		pictureManager.delPicture(id);
		return "del_success";
	}
	
	public String updateInput() {
		
		return "update_input";
	}
	
	public String update() {
		
		pictureManager.updatePicture(picture);
		return "update_success";
	}
	
	public String find() {
		
		picture = pictureManager.findPictureById(id);
		return "find_success";
	}

	public PictureManager getPictureManager() {
		return pictureManager;
	}

	public void setPictureManager(PictureManager pictureManager) {
		this.pictureManager = pictureManager;
	}

	public Picture getPicture() {
		return picture;
	}

	public void setPicture(Picture picture) {
		this.picture = picture;
	}

	public List getPictures() {
		return pictures;
	}

	public void setPictures(List pictures) {
		this.pictures = pictures;
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

}
